package com.gk.kafkaproduce.service.impl;

import com.gk.kafkaproduce.service.MyProduceTestService;
import com.gk.kafkaproduce.service.ProduceTestService;
import com.gk.kafkaproduce.source.MySource;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.stream.annotation.EnableBinding;
import org.springframework.cloud.stream.messaging.Source;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.stereotype.Service;


@Service
@EnableBinding(MySource.class)
public class MyProduceTestServiceImpl implements MyProduceTestService {

    @Autowired
    private MySource mySource;

    @Override
    public void sendMsg(String msg) {
        mySource.output().send(MessageBuilder.withPayload(msg).build());
    }
}
